﻿using System;
using CollegeSim.Domain.Entities;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CollegeSim.Domain.Test.Entities
{
    // Author: Ryan Redburn
    // Project: CollegeSim
    // Date: 2/24/2014

    [TestClass]
    public class InstructorTest
    {
        #region [ InstructorID ]

        [TestMethod]
        public void InstructorID_DefaultValue_EqualsExpected()
        {
            // Arrange
            var instructor = new Instructor();

            // Assert
            Assert.AreEqual(0, instructor.InstructorID);
        }

        #endregion

        #region [ OfficeNumber ]

        [TestMethod]
        public void OfficeNumber_BelowLength_ArgumentOutOfRangeException()
        {
            // Arrange
            var assert = false;
            var instructor = new Instructor
            {
                FirstName = "Ryan",
                LastName = "Redburn",
                PhoneNumber = "123-456-7890",
                Email = "rredburn@email.com",
                OfficeNumber = "IS201"
            };

            try
            {
                // Act
                instructor.OfficeNumber = "IS21";
            }
            catch (ArgumentOutOfRangeException)
            {
                assert = true;
            }
            finally
            {
                // Assert
                Assert.IsTrue(assert);
            }
        }

        [TestMethod]
        public void OfficeNumber_AboveLength_ArgumentOutOfRangeException()
        {
            // Arrange
            var assert = false;
            var instructor = new Instructor
            {
                FirstName = "Ryan",
                LastName = "Redburn",
                PhoneNumber = "123-456-7890",
                Email = "rredburn@email.com",
                OfficeNumber = "IS201"
            };

            try
            {
                // Act
                instructor.OfficeNumber = "IS2001";
            }
            catch (ArgumentOutOfRangeException)
            {
                assert = true;
            }
            finally
            {
                // Assert
                Assert.IsTrue(assert);
            }
        }

        #endregion
    }
}
